package com.common.net.demo;

import com.common.net.entity.HttpResult;

import java.util.Map;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
import rx.Observable;

/**
 * service统一接口数据
 * Created by WMM on 2017/7/24.
 */
public interface HttpService {
    @POST("user/login")
    Observable<HttpResult<Object>> userLogin(@QueryMap Map<String, String> params);
    @POST("user/suggest")
    @Multipart
    Observable<HttpResult<Object>> upFeedBack(@PartMap Map<String, RequestBody> file, @Query("uid") String uid,
                                              @Query("content") String content, @Query("contact") String contact);

    @POST("live/addMsg")
    @Multipart
    Observable<HttpResult<Object>> sendLiveVoice(@PartMap Map<String, RequestBody> file,
                                                 @Query("uid") String uid,@Query("room_id") String room_id, @Query("token") String token,@Query("type") String type);
    @POST("user/uploadHeadImg")
    @Multipart
    Observable<HttpResult<Object>> uploadFile(@PartMap Map<String, RequestBody> file,
                                              @Query("uid") String uid, @Query("token") String token);

    //当文件大时必须使用@streaming流
    @Streaming
    @GET
    Observable<ResponseBody> downloadFile(@Url String fileUrl);
}
